#ifndef CACHE_H
#define CACHE_H

#include <QJsonArray>
#include <QJsonObject>
#include <QString>

class Cache{
public:
    QString cacheName = "";
    QString cacheKey = "";
    QString cacheValue = "";
    QString remark = "";
    QJsonObject toJson() const {
        QJsonObject obj;
        obj["cacheName"] = cacheName;
        obj["cacheKey"] = cacheKey;
        obj["cacheValue"] = cacheValue;
        obj["remark"] = remark;
        return obj;
    }

    static Cache toCache(const QJsonObject &obj) {
        Cache Cache;
        Cache.cacheName = obj["cacheName"].toString();
        Cache.cacheKey = obj["cacheKey"].toString();
        Cache.cacheValue = obj["cacheValue"].toString();
        Cache.remark = obj["remark"].toString();
        return Cache;
    }
};

#endif // CACHE_H
